package adapters;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import entities.Album;

public class ChooseAlbumAdapter extends BaseAdapter {

	public ChooseAlbumAdapter(Context ctx, List<Album> albumsTitles) {
		super();
		this.ctx = ctx;
		this.albumsTitles = albumsTitles;
	}
	
	public void addAlbum(Album newAlbum) {
		albumsTitles.add(newAlbum);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return albumsTitles.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		TextView title;
		if(convertView == null){
			title = new TextView(ctx);
		} else{
			title = (TextView)convertView;
		}
		title.setText(albumsTitles.get(position).getTitle());
		title.setTextColor(Color.BLACK);
		
		return title;
	}
	
	private Context ctx;
	private List<Album> albumsTitles;
}
